package createThread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CreateThreadThree implements Callable<String> {

    public static void main(String[] args) {
        CreateThreadThree ctt = new CreateThreadThree();
        FutureTask<String> ft = new FutureTask<>(ctt);
        new Thread(ft, "线程名字").start();
        try {
            System.out.println("返回值：" + ft.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

    }

    @Override
    public String call() throws Exception {
        System.out.println(Thread.currentThread().getName());
        return "success";
    }
}
